package com.smz.controller;

import com.smz.entity.TType;
import com.smz.service.TTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TypeController {

    @Autowired
    TTypeService typeService;
    @GetMapping("/types/{id}")
    public ResponseEntity<List<TType>> findTypeByCompanyId(@PathVariable("id")int id){
        List<TType> typeByCompanyId = typeService.findTypeByCompanyId(id);
        return ResponseEntity.ok(typeByCompanyId);
    }
}
